<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>main.cpp 示例文件 | Qt Widgets 5.12.3</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td ><a href="../qtdoc/index.html">Qt 5.12</a></td><td ><a href="qtwidgets-index.html">Qt Widgets</a></td><td ><a href="qtwidgets-animation-states-example.html">States Example</a></td><td >main.cpp 示例文件</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="qtwidgets-index.html">Qt 5.12.3 参考指南</a></td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar"><div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">main.cpp 示例文件</h1>
<span class="subtitle">animation/states/main.cpp</span>
<!-- $$$animation/states/main.cpp-description -->
<div class="descr"> <a name="details"></a>
<pre class="cpp">

  <span class="comment">/****************************************************************************
  **
  ** Copyright (C) 2016 The Qt Company Ltd.
  ** Contact: https://www.qt.io/licensing/
  **
  ** This file is part of the QtCore module of the Qt Toolkit.
  **
  ** $QT_BEGIN_LICENSE:BSD$
  ** Commercial License Usage
  ** Licensees holding valid commercial Qt licenses may use this file in
  ** accordance with the commercial license agreement provided with the
  ** Software or, alternatively, in accordance with the terms contained in
  ** a written agreement between you and The Qt Company. For licensing terms
  ** and conditions see https://www.qt.io/terms-conditions. For further
  ** information use the contact form at https://www.qt.io/contact-us.
  **
  ** BSD License Usage
  ** Alternatively, you may use this file under the terms of the BSD license
  ** as follows:
  **
  ** &quot;Redistribution and use in source and binary forms, with or without
  ** modification, are permitted provided that the following conditions are
  ** met:
  **   * Redistributions of source code must retain the above copyright
  **     notice, this list of conditions and the following disclaimer.
  **   * Redistributions in binary form must reproduce the above copyright
  **     notice, this list of conditions and the following disclaimer in
  **     the documentation and/or other materials provided with the
  **     distribution.
  **   * Neither the name of The Qt Company Ltd nor the names of its
  **     contributors may be used to endorse or promote products derived
  **     from this software without specific prior written permission.
  **
  **
  ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  ** &quot;AS IS&quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.&quot;
  **
  ** $QT_END_LICENSE$
  **
  ****************************************************************************/</span>

  <span class="preprocessor">#include &lt;QtWidgets&gt;</span>

  <span class="keyword">class</span> Pixmap : <span class="keyword">public</span> <span class="type"><a href="qgraphicsobject.html">QGraphicsObject</a></span>
  {
      Q_OBJECT
  <span class="keyword">public</span>:
      Pixmap(<span class="keyword">const</span> <span class="type"><a href="../qtgui/qpixmap.html">QPixmap</a></span> <span class="operator">&amp;</span>pix) : <span class="type"><a href="qgraphicsobject.html">QGraphicsObject</a></span>()<span class="operator">,</span> p(pix)
      {
      }

      <span class="type">void</span> paint(<span class="type"><a href="../qtgui/qpainter.html">QPainter</a></span> <span class="operator">*</span>painter<span class="operator">,</span> <span class="keyword">const</span> <span class="type"><a href="qstyleoptiongraphicsitem.html">QStyleOptionGraphicsItem</a></span> <span class="operator">*</span><span class="operator">,</span> <span class="type"><a href="qwidget.html">QWidget</a></span> <span class="operator">*</span>) override
      {
          painter<span class="operator">-</span><span class="operator">&gt;</span>drawPixmap(<span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span>()<span class="operator">,</span> p);
      }

      <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> boundingRect() <span class="keyword">const</span> override
      {
          <span class="keyword">return</span> <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span>( <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span>(<span class="number">0</span><span class="operator">,</span> <span class="number">0</span>)<span class="operator">,</span> p<span class="operator">.</span>size());
      }

  <span class="keyword">private</span>:
      <span class="type"><a href="../qtgui/qpixmap.html">QPixmap</a></span> p;
  };

  <span class="keyword">class</span> GraphicsView : <span class="keyword">public</span> <span class="type"><a href="qgraphicsview.html">QGraphicsView</a></span>
  {
  <span class="keyword">public</span>:
      GraphicsView(<span class="type"><a href="qgraphicsscene.html">QGraphicsScene</a></span> <span class="operator">*</span>scene) : <span class="type"><a href="qgraphicsview.html">QGraphicsView</a></span>(scene)
      {
      }

      <span class="type">void</span> resizeEvent(<span class="type"><a href="../qtgui/qresizeevent.html">QResizeEvent</a></span> <span class="operator">*</span>) override
      {
          fitInView(sceneRect()<span class="operator">,</span> <span class="type"><a href="../qtcore/qt.html">Qt</a></span><span class="operator">::</span>KeepAspectRatio);
      }
  };

  <span class="type">int</span> main(<span class="type">int</span> argc<span class="operator">,</span> <span class="type">char</span> <span class="operator">*</span>argv<span class="operator">[</span><span class="operator">]</span>)
  {
      Q_INIT_RESOURCE(states);

      <span class="type"><a href="qapplication.html">QApplication</a></span> app(argc<span class="operator">,</span> argv);

      <span class="comment">// Text edit and button</span>
      <span class="type"><a href="qtextedit.html">QTextEdit</a></span> <span class="operator">*</span>edit <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qtextedit.html">QTextEdit</a></span>;
      edit<span class="operator">-</span><span class="operator">&gt;</span>setText(<span class="string">&quot;asdf lkjha yuoiqwe asd iuaysd u iasyd uiy &quot;</span>
                    <span class="string">&quot;asdf lkjha yuoiqwe asd iuaysd u iasyd uiy &quot;</span>
                    <span class="string">&quot;asdf lkjha yuoiqwe asd iuaysd u iasyd uiy &quot;</span>
                    <span class="string">&quot;asdf lkjha yuoiqwe asd iuaysd u iasyd uiy!&quot;</span>);

      <span class="type"><a href="qpushbutton.html">QPushButton</a></span> <span class="operator">*</span>button <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qpushbutton.html">QPushButton</a></span>;
      <span class="type"><a href="qgraphicsproxywidget.html">QGraphicsProxyWidget</a></span> <span class="operator">*</span>buttonProxy <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qgraphicsproxywidget.html">QGraphicsProxyWidget</a></span>;
      buttonProxy<span class="operator">-</span><span class="operator">&gt;</span>setWidget(button);
      <span class="type"><a href="qgraphicsproxywidget.html">QGraphicsProxyWidget</a></span> <span class="operator">*</span>editProxy <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qgraphicsproxywidget.html">QGraphicsProxyWidget</a></span>;
      editProxy<span class="operator">-</span><span class="operator">&gt;</span>setWidget(edit);

      <span class="type"><a href="qgroupbox.html">QGroupBox</a></span> <span class="operator">*</span>box <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qgroupbox.html">QGroupBox</a></span>;
      box<span class="operator">-</span><span class="operator">&gt;</span>setFlat(<span class="keyword">true</span>);
      box<span class="operator">-</span><span class="operator">&gt;</span>setTitle(<span class="string">&quot;Options&quot;</span>);

      <span class="type"><a href="qvboxlayout.html">QVBoxLayout</a></span> <span class="operator">*</span>layout2 <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qvboxlayout.html">QVBoxLayout</a></span>;
      box<span class="operator">-</span><span class="operator">&gt;</span>setLayout(layout2);
      layout2<span class="operator">-</span><span class="operator">&gt;</span>addWidget(<span class="keyword">new</span> <span class="type"><a href="qradiobutton.html">QRadioButton</a></span>(<span class="string">&quot;Herring&quot;</span>));
      layout2<span class="operator">-</span><span class="operator">&gt;</span>addWidget(<span class="keyword">new</span> <span class="type"><a href="qradiobutton.html">QRadioButton</a></span>(<span class="string">&quot;Blue Parrot&quot;</span>));
      layout2<span class="operator">-</span><span class="operator">&gt;</span>addWidget(<span class="keyword">new</span> <span class="type"><a href="qradiobutton.html">QRadioButton</a></span>(<span class="string">&quot;Petunias&quot;</span>));
      layout2<span class="operator">-</span><span class="operator">&gt;</span>addStretch();

      <span class="type"><a href="qgraphicsproxywidget.html">QGraphicsProxyWidget</a></span> <span class="operator">*</span>boxProxy <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qgraphicsproxywidget.html">QGraphicsProxyWidget</a></span>;
      boxProxy<span class="operator">-</span><span class="operator">&gt;</span>setWidget(box);

      <span class="comment">// Parent widget</span>
      <span class="type"><a href="qgraphicswidget.html">QGraphicsWidget</a></span> <span class="operator">*</span>widget <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qgraphicswidget.html">QGraphicsWidget</a></span>;
      <span class="type"><a href="qgraphicslinearlayout.html">QGraphicsLinearLayout</a></span> <span class="operator">*</span>layout <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qgraphicslinearlayout.html">QGraphicsLinearLayout</a></span>(<span class="type"><a href="../qtcore/qt.html">Qt</a></span><span class="operator">::</span>Vertical<span class="operator">,</span> widget);
      layout<span class="operator">-</span><span class="operator">&gt;</span>addItem(editProxy);
      layout<span class="operator">-</span><span class="operator">&gt;</span>addItem(buttonProxy);
      widget<span class="operator">-</span><span class="operator">&gt;</span>setLayout(layout);

      Pixmap <span class="operator">*</span>p1 <span class="operator">=</span> <span class="keyword">new</span> Pixmap(<span class="type"><a href="../qtgui/qpixmap.html">QPixmap</a></span>(<span class="string">&quot;:/digikam.png&quot;</span>));
      Pixmap <span class="operator">*</span>p2 <span class="operator">=</span> <span class="keyword">new</span> Pixmap(<span class="type"><a href="../qtgui/qpixmap.html">QPixmap</a></span>(<span class="string">&quot;:/akregator.png&quot;</span>));
      Pixmap <span class="operator">*</span>p3 <span class="operator">=</span> <span class="keyword">new</span> Pixmap(<span class="type"><a href="../qtgui/qpixmap.html">QPixmap</a></span>(<span class="string">&quot;:/accessories-dictionary.png&quot;</span>));
      Pixmap <span class="operator">*</span>p4 <span class="operator">=</span> <span class="keyword">new</span> Pixmap(<span class="type"><a href="../qtgui/qpixmap.html">QPixmap</a></span>(<span class="string">&quot;:/k3b.png&quot;</span>));
      Pixmap <span class="operator">*</span>p5 <span class="operator">=</span> <span class="keyword">new</span> Pixmap(<span class="type"><a href="../qtgui/qpixmap.html">QPixmap</a></span>(<span class="string">&quot;:/help-browser.png&quot;</span>));
      Pixmap <span class="operator">*</span>p6 <span class="operator">=</span> <span class="keyword">new</span> Pixmap(<span class="type"><a href="../qtgui/qpixmap.html">QPixmap</a></span>(<span class="string">&quot;:/kchart.png&quot;</span>));

      <span class="type"><a href="qgraphicsscene.html">QGraphicsScene</a></span> scene(<span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">400</span><span class="operator">,</span> <span class="number">300</span>);
      scene<span class="operator">.</span>setBackgroundBrush(scene<span class="operator">.</span>palette()<span class="operator">.</span>window());
      scene<span class="operator">.</span>addItem(widget);
      scene<span class="operator">.</span>addItem(boxProxy);
      scene<span class="operator">.</span>addItem(p1);
      scene<span class="operator">.</span>addItem(p2);
      scene<span class="operator">.</span>addItem(p3);
      scene<span class="operator">.</span>addItem(p4);
      scene<span class="operator">.</span>addItem(p5);
      scene<span class="operator">.</span>addItem(p6);

      <span class="type"><a href="../qtcore/qstatemachine.html">QStateMachine</a></span> machine;
      <span class="type"><a href="../qtcore/qstate.html">QState</a></span> <span class="operator">*</span>state1 <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="../qtcore/qstate.html">QState</a></span>(<span class="operator">&amp;</span>machine);
      <span class="type"><a href="../qtcore/qstate.html">QState</a></span> <span class="operator">*</span>state2 <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="../qtcore/qstate.html">QState</a></span>(<span class="operator">&amp;</span>machine);
      <span class="type"><a href="../qtcore/qstate.html">QState</a></span> <span class="operator">*</span>state3 <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="../qtcore/qstate.html">QState</a></span>(<span class="operator">&amp;</span>machine);
      machine<span class="operator">.</span>setInitialState(state1);

      <span class="comment">// State 1</span>
      state1<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(button<span class="operator">,</span> <span class="string">&quot;text&quot;</span><span class="operator">,</span> <span class="string">&quot;Switch to state 2&quot;</span>);
      state1<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(widget<span class="operator">,</span> <span class="string">&quot;geometry&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span>(<span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">400</span><span class="operator">,</span> <span class="number">150</span>));
      state1<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(box<span class="operator">,</span> <span class="string">&quot;geometry&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qrect.html">QRect</a></span>(<span class="operator">-</span><span class="number">200</span><span class="operator">,</span> <span class="number">150</span><span class="operator">,</span> <span class="number">200</span><span class="operator">,</span> <span class="number">150</span>));
      state1<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(p1<span class="operator">,</span> <span class="string">&quot;pos&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span>(<span class="number">68</span><span class="operator">,</span> <span class="number">200</span>)); <span class="comment">// 185));</span>
      state1<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(p2<span class="operator">,</span> <span class="string">&quot;pos&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span>(<span class="number">168</span><span class="operator">,</span> <span class="number">200</span>)); <span class="comment">// 185));</span>
      state1<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(p3<span class="operator">,</span> <span class="string">&quot;pos&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span>(<span class="number">268</span><span class="operator">,</span> <span class="number">200</span>)); <span class="comment">// 185));</span>
      state1<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(p4<span class="operator">,</span> <span class="string">&quot;pos&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span>(<span class="number">68</span> <span class="operator">-</span> <span class="number">150</span><span class="operator">,</span> <span class="number">48</span> <span class="operator">-</span> <span class="number">150</span>));
      state1<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(p5<span class="operator">,</span> <span class="string">&quot;pos&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span>(<span class="number">168</span><span class="operator">,</span> <span class="number">48</span> <span class="operator">-</span> <span class="number">150</span>));
      state1<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(p6<span class="operator">,</span> <span class="string">&quot;pos&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span>(<span class="number">268</span> <span class="operator">+</span> <span class="number">150</span><span class="operator">,</span> <span class="number">48</span> <span class="operator">-</span> <span class="number">150</span>));
      state1<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(p1<span class="operator">,</span> <span class="string">&quot;rotation&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span>(<span class="number">0</span>));
      state1<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(p2<span class="operator">,</span> <span class="string">&quot;rotation&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span>(<span class="number">0</span>));
      state1<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(p3<span class="operator">,</span> <span class="string">&quot;rotation&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span>(<span class="number">0</span>));
      state1<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(p4<span class="operator">,</span> <span class="string">&quot;rotation&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span>(<span class="operator">-</span><span class="number">270</span>));
      state1<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(p5<span class="operator">,</span> <span class="string">&quot;rotation&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span>(<span class="operator">-</span><span class="number">90</span>));
      state1<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(p6<span class="operator">,</span> <span class="string">&quot;rotation&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span>(<span class="number">270</span>));
      state1<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(boxProxy<span class="operator">,</span> <span class="string">&quot;opacity&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span>(<span class="number">0</span>));
      state1<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(p1<span class="operator">,</span> <span class="string">&quot;opacity&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span>(<span class="number">1</span>));
      state1<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(p2<span class="operator">,</span> <span class="string">&quot;opacity&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span>(<span class="number">1</span>));
      state1<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(p3<span class="operator">,</span> <span class="string">&quot;opacity&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span>(<span class="number">1</span>));
      state1<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(p4<span class="operator">,</span> <span class="string">&quot;opacity&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span>(<span class="number">0</span>));
      state1<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(p5<span class="operator">,</span> <span class="string">&quot;opacity&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span>(<span class="number">0</span>));
      state1<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(p6<span class="operator">,</span> <span class="string">&quot;opacity&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span>(<span class="number">0</span>));

      <span class="comment">// State 2</span>
      state2<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(button<span class="operator">,</span> <span class="string">&quot;text&quot;</span><span class="operator">,</span> <span class="string">&quot;Switch to state 3&quot;</span>);
      state2<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(widget<span class="operator">,</span> <span class="string">&quot;geometry&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span>(<span class="number">200</span><span class="operator">,</span> <span class="number">150</span><span class="operator">,</span> <span class="number">200</span><span class="operator">,</span> <span class="number">150</span>));
      state2<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(box<span class="operator">,</span> <span class="string">&quot;geometry&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qrect.html">QRect</a></span>(<span class="number">9</span><span class="operator">,</span> <span class="number">150</span><span class="operator">,</span> <span class="number">190</span><span class="operator">,</span> <span class="number">150</span>));
      state2<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(p1<span class="operator">,</span> <span class="string">&quot;pos&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span>(<span class="number">68</span> <span class="operator">-</span> <span class="number">150</span><span class="operator">,</span> <span class="number">185</span> <span class="operator">+</span> <span class="number">150</span>));
      state2<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(p2<span class="operator">,</span> <span class="string">&quot;pos&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span>(<span class="number">168</span><span class="operator">,</span> <span class="number">185</span> <span class="operator">+</span> <span class="number">150</span>));
      state2<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(p3<span class="operator">,</span> <span class="string">&quot;pos&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span>(<span class="number">268</span> <span class="operator">+</span> <span class="number">150</span><span class="operator">,</span> <span class="number">185</span> <span class="operator">+</span> <span class="number">150</span>));
      state2<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(p4<span class="operator">,</span> <span class="string">&quot;pos&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span>(<span class="number">64</span><span class="operator">,</span> <span class="number">48</span>));
      state2<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(p5<span class="operator">,</span> <span class="string">&quot;pos&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span>(<span class="number">168</span><span class="operator">,</span> <span class="number">48</span>));
      state2<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(p6<span class="operator">,</span> <span class="string">&quot;pos&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span>(<span class="number">268</span><span class="operator">,</span> <span class="number">48</span>));
      state2<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(p1<span class="operator">,</span> <span class="string">&quot;rotation&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span>(<span class="operator">-</span><span class="number">270</span>));
      state2<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(p2<span class="operator">,</span> <span class="string">&quot;rotation&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span>(<span class="number">90</span>));
      state2<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(p3<span class="operator">,</span> <span class="string">&quot;rotation&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span>(<span class="number">270</span>));
      state2<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(p4<span class="operator">,</span> <span class="string">&quot;rotation&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span>(<span class="number">0</span>));
      state2<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(p5<span class="operator">,</span> <span class="string">&quot;rotation&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span>(<span class="number">0</span>));
      state2<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(p6<span class="operator">,</span> <span class="string">&quot;rotation&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span>(<span class="number">0</span>));
      state2<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(boxProxy<span class="operator">,</span> <span class="string">&quot;opacity&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span>(<span class="number">1</span>));
      state2<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(p1<span class="operator">,</span> <span class="string">&quot;opacity&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span>(<span class="number">0</span>));
      state2<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(p2<span class="operator">,</span> <span class="string">&quot;opacity&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span>(<span class="number">0</span>));
      state2<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(p3<span class="operator">,</span> <span class="string">&quot;opacity&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span>(<span class="number">0</span>));
      state2<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(p4<span class="operator">,</span> <span class="string">&quot;opacity&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span>(<span class="number">1</span>));
      state2<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(p5<span class="operator">,</span> <span class="string">&quot;opacity&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span>(<span class="number">1</span>));
      state2<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(p6<span class="operator">,</span> <span class="string">&quot;opacity&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span>(<span class="number">1</span>));

      <span class="comment">// State 3</span>
      state3<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(button<span class="operator">,</span> <span class="string">&quot;text&quot;</span><span class="operator">,</span> <span class="string">&quot;Switch to state 1&quot;</span>);
      state3<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(p1<span class="operator">,</span> <span class="string">&quot;pos&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span>(<span class="number">0</span><span class="operator">,</span> <span class="number">5</span>));
      state3<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(p2<span class="operator">,</span> <span class="string">&quot;pos&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span>(<span class="number">0</span><span class="operator">,</span> <span class="number">5</span> <span class="operator">+</span> <span class="number">64</span> <span class="operator">+</span> <span class="number">5</span>));
      state3<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(p3<span class="operator">,</span> <span class="string">&quot;pos&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span>(<span class="number">5</span><span class="operator">,</span> <span class="number">5</span> <span class="operator">+</span> (<span class="number">64</span> <span class="operator">+</span> <span class="number">5</span>) <span class="operator">+</span> <span class="number">64</span>));
      state3<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(p4<span class="operator">,</span> <span class="string">&quot;pos&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span>(<span class="number">5</span> <span class="operator">+</span> <span class="number">64</span> <span class="operator">+</span> <span class="number">5</span><span class="operator">,</span> <span class="number">5</span>));
      state3<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(p5<span class="operator">,</span> <span class="string">&quot;pos&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span>(<span class="number">5</span> <span class="operator">+</span> <span class="number">64</span> <span class="operator">+</span> <span class="number">5</span><span class="operator">,</span> <span class="number">5</span> <span class="operator">+</span> <span class="number">64</span> <span class="operator">+</span> <span class="number">5</span>));
      state3<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(p6<span class="operator">,</span> <span class="string">&quot;pos&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span>(<span class="number">5</span> <span class="operator">+</span> <span class="number">64</span> <span class="operator">+</span> <span class="number">5</span><span class="operator">,</span> <span class="number">5</span> <span class="operator">+</span> (<span class="number">64</span> <span class="operator">+</span> <span class="number">5</span>) <span class="operator">+</span> <span class="number">64</span>));
      state3<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(widget<span class="operator">,</span> <span class="string">&quot;geometry&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span>(<span class="number">138</span><span class="operator">,</span> <span class="number">5</span><span class="operator">,</span> <span class="number">400</span> <span class="operator">-</span> <span class="number">138</span><span class="operator">,</span> <span class="number">200</span>));
      state3<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(box<span class="operator">,</span> <span class="string">&quot;geometry&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qrect.html">QRect</a></span>(<span class="number">5</span><span class="operator">,</span> <span class="number">205</span><span class="operator">,</span> <span class="number">400</span><span class="operator">,</span> <span class="number">90</span>));
      state3<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(p1<span class="operator">,</span> <span class="string">&quot;opacity&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span>(<span class="number">1</span>));
      state3<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(p2<span class="operator">,</span> <span class="string">&quot;opacity&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span>(<span class="number">1</span>));
      state3<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(p3<span class="operator">,</span> <span class="string">&quot;opacity&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span>(<span class="number">1</span>));
      state3<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(p4<span class="operator">,</span> <span class="string">&quot;opacity&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span>(<span class="number">1</span>));
      state3<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(p5<span class="operator">,</span> <span class="string">&quot;opacity&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span>(<span class="number">1</span>));
      state3<span class="operator">-</span><span class="operator">&gt;</span>assignProperty(p6<span class="operator">,</span> <span class="string">&quot;opacity&quot;</span><span class="operator">,</span> <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span>(<span class="number">1</span>));

      <span class="type"><a href="../qtcore/qabstracttransition.html">QAbstractTransition</a></span> <span class="operator">*</span>t1 <span class="operator">=</span> state1<span class="operator">-</span><span class="operator">&gt;</span>addTransition(button<span class="operator">,</span> SIGNAL(clicked())<span class="operator">,</span> state2);
      <span class="type"><a href="../qtcore/qsequentialanimationgroup.html">QSequentialAnimationGroup</a></span> <span class="operator">*</span>animation1SubGroup <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="../qtcore/qsequentialanimationgroup.html">QSequentialAnimationGroup</a></span>;
      animation1SubGroup<span class="operator">-</span><span class="operator">&gt;</span>addPause(<span class="number">250</span>);
      animation1SubGroup<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(box<span class="operator">,</span> <span class="string">&quot;geometry&quot;</span>));
      t1<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(animation1SubGroup);
      t1<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(widget<span class="operator">,</span> <span class="string">&quot;geometry&quot;</span>));
      t1<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p1<span class="operator">,</span> <span class="string">&quot;pos&quot;</span>));
      t1<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p2<span class="operator">,</span> <span class="string">&quot;pos&quot;</span>));
      t1<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p3<span class="operator">,</span> <span class="string">&quot;pos&quot;</span>));
      t1<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p4<span class="operator">,</span> <span class="string">&quot;pos&quot;</span>));
      t1<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p5<span class="operator">,</span> <span class="string">&quot;pos&quot;</span>));
      t1<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p6<span class="operator">,</span> <span class="string">&quot;pos&quot;</span>));
      t1<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p1<span class="operator">,</span> <span class="string">&quot;rotation&quot;</span>));
      t1<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p2<span class="operator">,</span> <span class="string">&quot;rotation&quot;</span>));
      t1<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p3<span class="operator">,</span> <span class="string">&quot;rotation&quot;</span>));
      t1<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p4<span class="operator">,</span> <span class="string">&quot;rotation&quot;</span>));
      t1<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p5<span class="operator">,</span> <span class="string">&quot;rotation&quot;</span>));
      t1<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p6<span class="operator">,</span> <span class="string">&quot;rotation&quot;</span>));
      t1<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p1<span class="operator">,</span> <span class="string">&quot;opacity&quot;</span>));
      t1<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p2<span class="operator">,</span> <span class="string">&quot;opacity&quot;</span>));
      t1<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p3<span class="operator">,</span> <span class="string">&quot;opacity&quot;</span>));
      t1<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p4<span class="operator">,</span> <span class="string">&quot;opacity&quot;</span>));
      t1<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p5<span class="operator">,</span> <span class="string">&quot;opacity&quot;</span>));
      t1<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p6<span class="operator">,</span> <span class="string">&quot;opacity&quot;</span>));

      <span class="type"><a href="../qtcore/qabstracttransition.html">QAbstractTransition</a></span> <span class="operator">*</span>t2 <span class="operator">=</span> state2<span class="operator">-</span><span class="operator">&gt;</span>addTransition(button<span class="operator">,</span> SIGNAL(clicked())<span class="operator">,</span> state3);
      t2<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(box<span class="operator">,</span> <span class="string">&quot;geometry&quot;</span>));
      t2<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(widget<span class="operator">,</span> <span class="string">&quot;geometry&quot;</span>));
      t2<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p1<span class="operator">,</span> <span class="string">&quot;pos&quot;</span>));
      t2<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p2<span class="operator">,</span> <span class="string">&quot;pos&quot;</span>));
      t2<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p3<span class="operator">,</span> <span class="string">&quot;pos&quot;</span>));
      t2<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p4<span class="operator">,</span> <span class="string">&quot;pos&quot;</span>));
      t2<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p5<span class="operator">,</span> <span class="string">&quot;pos&quot;</span>));
      t2<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p6<span class="operator">,</span> <span class="string">&quot;pos&quot;</span>));
      t2<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p1<span class="operator">,</span> <span class="string">&quot;rotation&quot;</span>));
      t2<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p2<span class="operator">,</span> <span class="string">&quot;rotation&quot;</span>));
      t2<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p3<span class="operator">,</span> <span class="string">&quot;rotation&quot;</span>));
      t2<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p4<span class="operator">,</span> <span class="string">&quot;rotation&quot;</span>));
      t2<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p5<span class="operator">,</span> <span class="string">&quot;rotation&quot;</span>));
      t2<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p6<span class="operator">,</span> <span class="string">&quot;rotation&quot;</span>));
      t2<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p1<span class="operator">,</span> <span class="string">&quot;opacity&quot;</span>));
      t2<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p2<span class="operator">,</span> <span class="string">&quot;opacity&quot;</span>));
      t2<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p3<span class="operator">,</span> <span class="string">&quot;opacity&quot;</span>));
      t2<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p4<span class="operator">,</span> <span class="string">&quot;opacity&quot;</span>));
      t2<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p5<span class="operator">,</span> <span class="string">&quot;opacity&quot;</span>));
      t2<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p6<span class="operator">,</span> <span class="string">&quot;opacity&quot;</span>));

      <span class="type"><a href="../qtcore/qabstracttransition.html">QAbstractTransition</a></span> <span class="operator">*</span>t3 <span class="operator">=</span> state3<span class="operator">-</span><span class="operator">&gt;</span>addTransition(button<span class="operator">,</span> SIGNAL(clicked())<span class="operator">,</span> state1);
      t3<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(box<span class="operator">,</span> <span class="string">&quot;geometry&quot;</span>));
      t3<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(widget<span class="operator">,</span> <span class="string">&quot;geometry&quot;</span>));
      t3<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p1<span class="operator">,</span> <span class="string">&quot;pos&quot;</span>));
      t3<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p2<span class="operator">,</span> <span class="string">&quot;pos&quot;</span>));
      t3<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p3<span class="operator">,</span> <span class="string">&quot;pos&quot;</span>));
      t3<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p4<span class="operator">,</span> <span class="string">&quot;pos&quot;</span>));
      t3<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p5<span class="operator">,</span> <span class="string">&quot;pos&quot;</span>));
      t3<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p6<span class="operator">,</span> <span class="string">&quot;pos&quot;</span>));
      t3<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p1<span class="operator">,</span> <span class="string">&quot;rotation&quot;</span>));
      t3<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p2<span class="operator">,</span> <span class="string">&quot;rotation&quot;</span>));
      t3<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p3<span class="operator">,</span> <span class="string">&quot;rotation&quot;</span>));
      t3<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p4<span class="operator">,</span> <span class="string">&quot;rotation&quot;</span>));
      t3<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p5<span class="operator">,</span> <span class="string">&quot;rotation&quot;</span>));
      t3<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p6<span class="operator">,</span> <span class="string">&quot;rotation&quot;</span>));
      t3<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p1<span class="operator">,</span> <span class="string">&quot;opacity&quot;</span>));
      t3<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p2<span class="operator">,</span> <span class="string">&quot;opacity&quot;</span>));
      t3<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p3<span class="operator">,</span> <span class="string">&quot;opacity&quot;</span>));
      t3<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p4<span class="operator">,</span> <span class="string">&quot;opacity&quot;</span>));
      t3<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p5<span class="operator">,</span> <span class="string">&quot;opacity&quot;</span>));
      t3<span class="operator">-</span><span class="operator">&gt;</span>addAnimation(<span class="keyword">new</span> <span class="type"><a href="../qtcore/qpropertyanimation.html">QPropertyAnimation</a></span>(p6<span class="operator">,</span> <span class="string">&quot;opacity&quot;</span>));

      machine<span class="operator">.</span>start();

      GraphicsView view(<span class="operator">&amp;</span>scene);

      view<span class="operator">.</span>show();

      <span class="keyword">return</span> app<span class="operator">.</span>exec();
  }

  <span class="preprocessor">#include &quot;main.moc&quot;</span>

</pre>
</div>
<!-- @@@animation/states/main.cpp -->
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2019 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br/>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br/>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>
